<?php

namespace Yj\Generator\Core\Processor;


use Hyperf\Utils\Str;
use Yj\Generator\Core\Config;
use Yj\Generator\Core\Model\EloquentModel;
use Yj\Generator\Core\Model\NamespaceModel;

/**
 * @Notes: []
 * @User: zwc
 * @Date: 2022/3/1 14:12
 */
class NamespaceProcessor
{
    /**
     * @inheritdoc
     */
    public function process(EloquentModel $model, Config $config)
    {

        $namespace = $config->get('namespace');
        if ($config->has('dirname') && $config->get('dirname')) {
            $namespace = $namespace . '\\' . Str::ucfirst($config->get('dirname'));
        }

        $model->setNamespace(new NamespaceModel($namespace));
    }
}